<%@page import="sys.wx.xy.XY"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%    if (null != session.getAttribute(XY.SESSION_LOGIN)) {
        response.sendRedirect("dc_view/buy/fwy/kd.jsp");
        return;
    }
%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <script src="zj/jq/jquery-1.11.3.min.js"></script>
        <link rel="stylesheet" href="zj/uikit/css/uikit.gradient.min.css" />

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>登陆</title>
            <style>
                body { padding-top: 110px; }
            </style>
            <script type="text/javascript">
                function doEmtpy() {
                    $("#code").val("");
                }
                function checklogin() {
                    var name = $("#account").val();
                    var content = $("#password").val();
                    var vcode = $("#code").val();
                    var str = "";
                    if (name.trim() == "") {
                        str = str + "<p>账号 需要输入</p>";
                    }
                    if (content.trim() == "" || content.length == 0) {
                        str = str + "<p>密码 需要输入</p>";
                    }
                    if (vcode.length != 4) {
                        str = str + "<p>验证码 需要正确输入</p>";
                    }
                    if (str.length > 0) {
                        lookThisgg(str);
                        return false;
                    } else {

                        $.post("user/fwy/login.imy", {
                            "account": name, "password": content, "code": vcode
                        }, function (x) {
                            if (null != x && x == "1") {
                                lookThisgg("查无此账号。或账号已经停用");
                            } else if (x == "3") {
                                lookThisgg("验证码有误!");
                            } else if (x == "4") {
                                lookThisgg("验证码已过期，请刷新后，重新输入!");
                            } else if (x == "0") {
                                window.location.href = 'dc_view/buy/fwy/xd_food.jsp';
                            }
                        });
                        return  false;
                    }
                    return false;
                }
                function lookThisgg(c) {
                    $("#IDError").html(c);
                    setTimeout(function () {
                        lookThisgg("");
                    }, 7000);
                }
            </script>
    </head>
    <body>

        <div  align="center" >
            <div id="IDError" style="height: 150px;">

            </div>
            <div>
                <form onsubmit="return checklogin();">
                    <table class="table">
                        <tr>
                            <td>您的账号</td><td><input type="text"  name="account"id="account" placeholder="您的账号" maxlength="16"></td><td></td>
                        </tr>
                        <tr>
                            <td>您的密码</td><td><input type="password" name="password"id="password" placeholder="您的密码" maxlength="16"></td><td></td>
                        </tr>
                        <tr>
                            <td>验证码</td><td><input type="text" name="code" id="code"placeholder="请输入右边的验证码"></td><td><a href="javascript:void(0)" onclick="dd();">
                                    <img id="asddfsdf" src="components/safeCode/4numberSafeCode.imy"/>
                                </a></td>
                        </tr>
                        <tr>
                            <td></td><td><button id="buttonajax">提交</button></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <script>
            function dd() {
                jQuery("#asddfsdf").attr("src", function () {
                    return "components/safeCode/4numberSafeCode.imy?11=" + (new Date()).getUTCMilliseconds();
                });
            }
        </script>
    </body>
</html>
